﻿using Crap4Net;
using System;
using NUnit.Framework;
using Crap4Net.CCParsers;

namespace Crap4Net.UnitTests.CCParsersTests
{
    [TestFixture]
    public class CCParserFactoryTests
    {
        [Test]
        public void CreateCCParser_AskedForCodeMetrics_returnCodeMetricParser()
        {
            var actual = CCParserFactory.CreateParser(CCParserFactory.CODEMETRICS_TOOL_NAME);
            
            Assert.IsInstanceOf<VSMetricsParser>(actual);
        }

        [Test]
        public void CreateCCParser_AskedForReflectorParser_ReturnsReflectorParser()
        {
            var actual = CCParserFactory.CreateParser(CCParserFactory.REFLECTOR_TOOL_NAME);

            Assert.IsInstanceOf<ReflectorParser>(actual);
        }

        [Test]
        public void CreateCCParser_AskedForIllegalParser_ThrowsException()
        {
            Assert.Throws<ArgumentException>(() => CCParserFactory.CreateParser("no_Such_tool"));

        }

    }
}
